package com.dongdong.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdong.data.DataResult;
import com.dongdong.data.ResponseStatusEnum;
import com.dongdong.pojo.TbSeller;
import com.dongdong.service.SellerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/14 8:47
 * @Version 1.0
 **/
@Controller
@RequestMapping("sellerController")
public class SellerController {

    @Reference
    private SellerService sellerService;

    private static final Logger logger = LoggerFactory.getLogger(SellerController.class);

    @RequestMapping("saveRegister")
    @ResponseBody
    public DataResult saveRegister(TbSeller tbSeller){
        try {
            int i = sellerService.saveRegister(tbSeller);
            return DataResult.response(ResponseStatusEnum.SUCCESS).setData(i);
        }catch (Exception e){
            logger.error("增加失败",e);
            return DataResult.response(ResponseStatusEnum.INTERNAL_SERVER_ERROR);
        }
    }

    @RequestMapping("showLogin")
    public String showLogin(){
        return "shoplogin";
    }


}

